import KoaRouter from 'koa-router'
import Config from '@/config/Config'
import { Models } from '@/common/typings/modle'
import { emitAll } from '@/core/SocketServer'
import { Success } from '@/core/HttpException'
const router = new KoaRouter({
  prefix: `${Config.API_PREFIX}v1/system/websocket`,
})
router.post('/sendAll', async (ctx: Models.Ctx) => {
  emitAll({
    key: 's2c',
    value: {
      type: 'broadcast',
      message: '全局提示',
    },
  })
  throw new Success()
})
export default router
